import Taro from '@tarojs/taro'
import { View, Image, Button } from '@tarojs/components'
import { Icon } from '@antmjs/vantui'
import './CompleteModal.less'


const CompleteModal = props => {

  const goHome = () => {
    Taro.switchTab({
      url: '/pages/index/index'
    })
  }

  return props.show ?
    (
      <View className='mask'>
        <View className='modal-box'>
          <View className='back-box'>
            <Icon onClick={() => props.close && props.close(false)} name='arrow-left' />
          </View>
          <Image className='modal-img' src={require('../assets/images/info-edit-success.png')} />
          {/* <Image className='modal-img' src={require('../assets/images/info-edit-fail.png')} /> */}
          <View className='modal-title'>个人信息提交{props.success ? '成功' : '失败'}</View>
          {
            !props.success ?
              (<View className='fail-tips'>当前手机号、微信群信息已存在无法重复提交</View>) :
              ''
          }
          <View className='btn-group'>
            {
              props.success ?
                (
                  <>
                    <View className='btn plain-btn' onClick={goHome}>返回首页</View>
                    <View className='btn fill-btn'>
                      <View className='btn-inner-box'>查看详情</View>
                    </View>
                  </>
                ) :
                (
                  <>
                    <Button className='contact-btn' openType='contact'>
                      <View className='btn plain-btn'>联系客服</View>
                    </Button>
                    <View className='btn fill-btn'>
                      <View className='btn-inner-box'>重新填写</View>
                    </View>
                  </>
                )
            }
          </View>
        </View>
      </View>
    ) : ''
}

export default CompleteModal